<?php
/**
 * 站点设置 api
 * @author maniac
 */
namespace app\common\service;

use app\facade\Options AS OptionsFacade;

class Site extends Base
{
    /**
     * 获取站点设置信息
     * @return [type] [description]
     */
    public function appInfo()
    {
        return unserialize(OptionsFacade::option('app_info'));
    }
    
    /**
     * 获取积分设置
     */
    public function pointsSetting()
    {
        $options = $this->appInfo();
        $data    = [
            'points_rate'       => $options['points_rate'],
            'register_points'   => $options['register_points'],
            'order_points_rate' => $options['order_points_rate'],
            'points_buy_limit'  => $options['points_buy_limit'],
        ];
        return $data;
    }
    
    /**
     * 获取抵用券设置
     */
    public function vouchersSetting()
    {
        $options = $this->appInfo();
        $data    = [
            'vouchers_rate'      => $options['vouchers_rate'],
            'vouchers_buy_limit' => $options['vouchers_buy_limit']
        ];
        return $data;
    }
}
